package com.zzyk.microCloud.api.controller;

import com.zzyk.main.model.pojo.Area;
import com.zzyk.main.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wss_PC
 * @DESCRIPTION 地域查询
 * @create 2020-6-23
 */
@RestController
@RequestMapping("/api/area")
public class ApiAreaController {
    @Autowired
    private AreaService areaService;
    /**
     * 根据市查询县
     * @return
     */
    @GetMapping("/getCounty")
    public List<Area> getCounty(String city, String province){
        return areaService.selectAllByCity(city,province);
    }
    /**
     * 通过省份查询下面的市
     * @param province
     * @return
     */
    @GetMapping("/getCity")
    public List<Area> getCity(String province){
        return areaService.selectAllByProvince(province);
    }
    /**
     * 获取省份信息
     * @return
     */
    @GetMapping("/getProvince")
    public List<Area> getProvince(){
       return areaService.selectProvince();
    }
}